package com.smart.list;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.smart.list.entity.Task;
import com.smart.list.service.TaskService;

@Controller
public class TaskController {
	private static final Logger logger = LoggerFactory.getLogger(TaskController.class);
	
	private TaskService taskService;
	
	@Autowired
	public TaskController (TaskService taskService) {
		super();
		this.taskService = taskService;
	}
	
	@RequestMapping(value="/tasks/send", method=RequestMethod.GET)
	public @ResponseBody Task doRequest( @RequestParam String task) {
		
		//TODO: add contexts
		//String context = "kupiti";
		//List<Task> tasks = taskService.getTasks(context );
		Task task1 = new Task(task);
		logger.info("task is sended :" + task);

		return task1;
	}
}
